home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
prog
/
anidial.arj
/
SIMPLE.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1994-01-23
|
3KB
|
84 lines
{
Sample program for unit AnimateDialog written by Tim Schempp, January, 1994.
This program demonstrates what is involved with animating a dialog box using
the unit ANIMATEDIALOG. Although the program may look long, all of the
procedures are generally overrided in any application. The minimum you must
add to animate Dialog Boxes is as follows:
1 Variables for each Animate Dialog Box.
3 Lines of code for each Animate Dialog Box.
2 Lines of Code for each animate View.
The rest of this program is just usual Turbo Vision overhead. Read the
documentation for further infomation on using the Animator, it can really
add a fun twist to an otherwise serious program.
Please feel free to use the Dialog Box Animator in any of you programs,
and pass it on to friends. I will get a big kick out of seeing it used in
somebody elses program.
}
program Simple;
uses Objects,Views,Dialogs,App,AnimateDialog;
type
TSimpleApp=object(TApplication)
PSimpleDialog:PAnimateDialog;
procedure SimpleDialog;
procedure Idle; virtual;
end; {object}
{******}
procedure TSimpleApp.SimpleDialog;
var R,Bounds:TRect;
AView:PView;
AniItem:PAniItem; {An animation entry object.}
begin
R.Assign(20,2,60,20);
PSimpleDialog:=New(PAnimateDialog,Init(R,'Look an Animate Dialog Box!'));
with PSimpleDialog^ do
begin
{Make A View}
R.Assign(15,13,25,15);
AView:=New(PButton,Init(R,'~O~k',cmOk,bfDefault));
Insert(AView);
{Add it to the Animation List}
GetExtent(Bounds); {<-Create a Boundry for the Animation}
Inc(Bounds.B.X,-1); Inc(Bounds.B.Y,-1);
Inc(Bounds.A.X,1); Inc(Bounds.A.Y,1);
AniItem:=New(PAniItem,Init(AView,Bounds,AniBounceAround,11,3,1));
AniList^.Insert(AniItem);
end; {with}
DeskTop^.ExecView(PSimpleDialog);
Dispose(PSimpleDialog,Done);
{*** !!! ***}
PSimpleDialog:=nil; {Important set the pointer to nil when the Box is
Disposed of or the system will freeze when it tries
to UpDate the nonexistant Dialog Box!!!}
end;
{******}
procedure TSimpleApp.Idle;
begin
inherited Idle;
if PSimpleDialog<>nil then PSimpleDialog^.UpDate;
end;
{******}
var SimpleApp:TSimpleApp;
begin
SimpleApp.Init;
SimpleApp.SimpleDialog;
SimpleApp.Run;
SimpleApp.Done;
end.